<template>
<!--  This is the navBar of Portal Page-->
  <div class="navBar">
    <div class="nav">
      <div class="logo">LOGO  学者库</div>

      <div class="searchBar">
        <el-input placeholder="请输入内容检索" v-model="searchText" size="medium">
          <template #prepend>
            <el-select v-model="selectClass" size="medium" style="width: 100px">
              <el-option label="姓名" value="1"></el-option>
              <el-option label="单位" value="2"></el-option>
            </el-select>
          </template>
          <template #append>
            <el-button icon="el-icon-search" size="medium"
                       @click="search(selectClass, searchText)">
            </el-button>
          </template>

        </el-input>

      </div>
    </div>

    <el-divider></el-divider>
  </div>

</template>

<script>
import { ElMessage } from 'element-plus'
export default {
  name: "portal_navBar",
  data() {
    return {
      searchText: '',
      selectClass: '姓名',
    }
  },
  methods: {
    search(searchClass, searchText) {
      console.log(searchClass, searchText);
      if (searchText === '') {
        ElMessage.warning('请输入检索内容');
        console.log('Error: np searchText');
        return;
      }

    }
  }
}
</script>

<style scoped>
.navBar {
  width: 100%;
  background-color: #0d84ff;
  color: #ffffff;
}

.nav {
  margin-top: 5px;
  height: 60px;
  display: flex;
}

.logo {
  margin-left: 5%;
  margin-top: 30px;
}
.searchBar {
  align-items: center;
  margin-left: 40%;
  margin-top: 23px;
  width: 30%;
}

.searchBar >>> .el-input {
  /*background-color: white;*/
  margin-left: 0;
  /*width: 70%;*/
}

</style>